package com.ruoyi.common.core.page;

import cn.hutool.http.HttpStatus;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.esotericsoftware.kryo.serializers.DefaultSerializers;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ruoyi.common.core.domain.BigDecimalSerializer;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 表格分页数据对象
 *
 * @author Lion Li
 */

@Data
@NoArgsConstructor
public class TableDataInfo<T> implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 总记录数
     */
    private long total;

    /**
     * 总记录数
     */
    private long yichangtotal;

    /**
     * 总记录数
     */
    private long daichutotal;


    /**
     * 总记录数
     */
    private long yichulitotal;

    /**
     * 总记录数
     */
    private long quanbutotal;


    /**
     * 总记录数
     */
    private long shenhetotal;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal scbycuntotal;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal scbyxitotal;


    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal scqutbyotal;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal scbycuntotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal scbyxitotalPri;


    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal scqutbyotalPri;


    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal yubycuntotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal yubycuntotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal yubyxitotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal yubyxitotalPri;


    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal yubyqutotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal yubyqutotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal dadoubycuntotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal dadoubycuntotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal dadoubyxitotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal dadoubyxitotalPri;


    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal dadoubyqutotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal dadoubyqutotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gubycuntotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gubycuntotalPri;


    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gudixiabycuntotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gudixiabycuntotalPri;


    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gudibiaobycuntotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gudibiaobycuntotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gubyxitotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gubyxitotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gudixiabyxitotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gudixiabyxitotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gudibiaobyxitotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gudibiaobyxitotalPri;


    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gubyqutotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gubyqutotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gudixiabyqutotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gudixiabyqutotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gudibiaobyqutotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal gudibiaobyqutotalPri;


    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdoubycuntotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdoubycuntotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdouGaoyoubycuntotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdouGaoyoubycuntotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdouGaodanbaibycuntotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdouGaodanbaibycuntotalPri;



    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdoubyxitotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdoubyxitotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdouGaoyoubyxitotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdouGaoyoubyxitotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdouGaodanbaibyxitotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdouGaodanbaibyxitotalPri;



    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdoubyqutotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdoubyqutotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdouGaoyoubyqutotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdouGaoyoubyqutotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdouGaodanbaibyqutotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal youdouGaodanbaibyqutotalPri;


    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal farmlandbycuntotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal farmlandbycuntotalPri;

    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal farmlandbyxitotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal farmlandbyxitotalPri;


    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal farmlandbyqutotal;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal farmlandbyqutotalPri;


    /**
     * 总记录数
     */
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallonebycun;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curalloneprebycun;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curalltwobycun;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curalltwoprebycun;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallthreebycun;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallthreeprebycun;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallfourbycun;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallfourprebycun;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal cropallbycun;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal cropallprebycun;

    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallonebyxi;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curalloneprebyxi;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curalltwobyxi;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curalltwoprebyxi;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallthreebyxi;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallthreeprebyxi;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallfourbyxi;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallfourprebyxi;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal cropallbyxi;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal cropallprebyxi;

    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallonebyqu;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curalloneprebyqu;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curalltwobyqu;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curalltwoprebyqu;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallthreebyqu;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallthreeprebyqu;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallfourbyqu;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal curallfourprebyqu;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal cropallbyqu;
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal cropallprebyqu;






    @TableField(exist = false)
    private  Boolean xitiFlag;


    @TableField(exist = false)
    private  Boolean qutiFlag;




    /**
     * 列表数据
     */
    private List<T> rows;

    /**
     * 消息状态码
     */
    private int code;

    /**
     * 消息内容
     */
    private String msg;

    /**
     * 分页
     *
     * @param list  列表数据
     * @param total 总记录数
     */
    public TableDataInfo(List<T> list, long total) {
        this.rows = list;
        this.total = total;
    }

    public static <T> TableDataInfo<T> build(IPage<T> page) {
        TableDataInfo<T> rspData = new TableDataInfo<>();
        rspData.setCode(HttpStatus.HTTP_OK);
        rspData.setMsg("查询成功");
        rspData.setRows(page.getRecords());
        rspData.setTotal(page.getTotal());
        return rspData;
    }

    public static <T> TableDataInfo<T> build(List<T> list) {
        TableDataInfo<T> rspData = new TableDataInfo<>();
        rspData.setCode(HttpStatus.HTTP_OK);
        rspData.setMsg("查询成功");
        rspData.setRows(list);
        rspData.setTotal(list.size());
        return rspData;
    }

    public static <T> TableDataInfo<T> build() {
        TableDataInfo<T> rspData = new TableDataInfo<>();
        rspData.setCode(HttpStatus.HTTP_OK);
        rspData.setMsg("查询成功");
        return rspData;
    }

}
